import 'package:fluent_ui/fluent_ui.dart';
import 'package:url_launcher/link.dart';

class LinkPaneItemAction extends PaneItem {
  final String link;

  LinkPaneItemAction({
    super.title,
    required super.icon,
    required super.body,
    required this.link,
  });

  @override
  Widget build(
    final BuildContext context,
    final bool selected,
    final VoidCallback? onPressed, {
    final PaneDisplayMode? displayMode,
    final bool showTextOnTop = true,
    final int? itemIndex,
    final bool? autofocus,
  }) =>
      Link(
        uri: Uri.parse(link),
        builder: (_, followLink) => Semantics(
          link: true,
          child: super.build(
            context,
            selected,
            followLink,
            displayMode: displayMode,
            showTextOnTop: showTextOnTop,
            itemIndex: itemIndex,
            autofocus: autofocus,
          ),
        ),
      );
}
